//index.js
//获取应用实例
var app = getApp()

Page({
  data: {
    hot: "",
    indicatorDots: false,
    autoplay: true,
    interval: 2000,
    duration: 1000
  },
  //事件处理函数
  to_link: function (event) {
    wx.navigateTo({
      url: '../detail/details'
    })
    console.log(event)
    // 存储在全局里
    app.globalData.hot= event.currentTarget.dataset.comicdata;
  },
 
  onLoad: function () {
    var that = this;
    wx.request({
      url: "http://sum-l.gitee.io/comic-l/source/hot.json",
      data: {
        key: "",
        comicName: "",
        id: ""
      },
      header: {
        'content-type': 'application/json' // 默认值
      },
      dataType: "json",
      success: function (res) {
        //dataType为json时，会自动对请求结果进行一下JSON.parse,
        //不规范会报错
        that.setData({
          hot: res.data.hot
        })
      }
    })

  },
})
